package detect;

import java.util.ArrayList;

import data.MethodsConstraints;
import detect.parse.ParseResult;

public class DetectResult {
	public ParseResult pr=null;
	public ArrayList<ArrayList<Integer>> setList;
	public MethodsConstraints[] items;
	
	public DetectResult(ParseResult _pr,ArrayList<ArrayList<Integer>> _setList,MethodsConstraints[] _items){
		pr=_pr;
		setList=_setList;
		items=_items;
	}
	
	@Override
	public String toString(){		
		StringBuilder sb=new StringBuilder();
		//sb.append("\nsetsSize="+setList.size());
		sb.append(pr.funName);
		sb.append(":\r\n");
		for(int i=0; i<setList.size(); i++){
			sb.append("pattern "+i+": \n");
			ArrayList<Integer> set=setList.get(i);
			for(int j=0;j<set.size();j++){				
				MethodsConstraints mc=items[set.get(j)];
				sb.append("    "+mc.left_event_name+" < "+mc.right_event_name);
				if(j<set.size()-1){
					sb.append(",\r\n");
				}
				else{
					sb.append(".\r\n");
				}
			}
			sb.append("\n");
		}
		return sb.toString();
	}
}
